//
//  DynamicTableViewCell.swift
//  BusinessIOS
//
//  Created by Rain on 2018/11/3.
//  Copyright © 2018 XingJian Li. All rights reserved.
//

import UIKit

class DynamicTableViewCell: UITableViewCell {

    var titleLabel:UILabel!
    
    var nameLabel:UILabel!
    
    var timeLabel:UILabel!
    
  
    
    required init?(coder aDecoder: NSCoder) {
        
        super.init(coder: aDecoder)
        
    }
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.lauoutUI()
        
    }
    // 赋值方法 - 显示 cell 内容方法
    func investmentDynamicsWithModel(model: DynamicModel) {
        
        
        titleLabel.text = "投资动态"
        nameLabel.text = model.title
        
        timeLabel.text = model.createtime
    
        
    }
    func lauoutUI(){
        
        titleLabel = UILabel()
        titleLabel.backgroundColor = UIColor.groupTableViewBackground
        titleLabel.text = "省招商局与云南财经大学共同举办校友会"
        titleLabel.textAlignment = .center
        titleLabel.font = UIFont.systemFont(ofSize:15)//一般方法
        self.contentView.addSubview(self.titleLabel!)
        
        
        nameLabel = UILabel()
        
        nameLabel.text = "为了抓紧国家i一带一路战略多大事多是否会将坑我呢明年我们为，们，慢慢都没，安师大卡进度款拉近了看大家来看氨基酸考虑到"
        nameLabel.font = UIFont.systemFont(ofSize:12)//一般方法
        nameLabel.numberOfLines = 0
        nameLabel.backgroundColor = UIColor.groupTableViewBackground
        self.contentView.addSubview(self.nameLabel!)
        
        timeLabel = UILabel()
        timeLabel.backgroundColor = UIColor.groupTableViewBackground
        timeLabel.text = "2018-05-22"
        timeLabel.font = UIFont.systemFont(ofSize:12)//一般方法
        self.contentView.addSubview(self.timeLabel!)
        
        self.layoutView()
        
    }
    
    func layoutView() {
        
        self.titleLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(5)
            make.left.equalTo(self.snp.left).offset(10)
            make.right.equalTo(self.snp.right).offset(-10)
            make.height.equalTo(30)
        }
        
        self.nameLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.titleLabel.snp.bottom).offset(0)
            make.left.equalTo(self.snp.left).offset(10)
            make.right.equalTo(self.snp.right).offset(-10)
            make.height.equalTo(40)
        }
        
        self.timeLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.nameLabel.snp.bottom).offset(0)
            make.left.equalTo(self.snp.left).offset(10)
            make.right.equalTo(self.snp.right).offset(-10)
            make.bottom.equalTo(self.snp.bottom).offset(-5)
        }
        
        
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
